<template>
	<view>
		<!-- 轮播 -->
		<cu-custom bgColor="bg-gradual-green" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">公共场所预约</block>
		</cu-custom>
		<uni-section title="我的预约" type="line" class="solid-bottom" :style="[{animation: 'show 0.5s 1'}]"></uni-section>
		<view class="cu-list grid col-4 text-sm">
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: 0.05 + 's'}]"
				@tap="goPage('myAppointment')">
				<view class="padding text-center">
					<image src="/static/home/128/wendang.png" style="width:28px;height:28px;"></image>
					<view class="margin-top-xs">我的预约</view>
				</view>
			</view>
		</view>
		<uni-section title="公共场所预约" type="line" class="solid-bottom" :style="[{animation: 'show 0.5s 1'}]">
		</uni-section>
		<view class="cu-list menu solid-bottom" :style="[{animation: 'show 0.5s 1'}]">
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: 0.05 + 's'}]" v-for="(item,index) of poList" :key="index">
				<view class="content padding-tb-sm">
					<view class="text-bold">{{item.name}}</view>
					<view class="text-gray text-sm">
						<text class="cuIcon-infofill margin-right-xs"></text>{{item.name}}详情
					</view>
					<view class="text-gray text-sm">
						<text class="cuIcon-infofill margin-right-xs"></text>可容纳人数：{{item.maxContain}}
					</view>
				</view>
				<view class="action">
					<button class="cu-btn round bg-gradual-green shadow" @tap="toForm(item.id)">
						<text class="cuIcon-upload"></text>预约</button>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	const icon_prefix = "/static/home/128/"
	export default {
		data() {
			return {
				poList: [],
			}
		},
		mounted() {
			this.initList()
		},
		methods: {
			initList(){
				this.$http.get('/publicplace/znzfPublic/list').then((res) => {
					if(res.data.success){
						this.poList=res.data.result.records
					}else{
						this.$tip.alert('获取失败' + res.errMsg);
					}
				})
			},
			toForm(id) {
				// 带参数跳转
				uni.navigateTo({
					url: `/pages/zhzf/publicPlaceForm?id=${id}`
				})
				// this.$router.push({
				// 	name:"publicPlaceForm",
				// 	params:{type:type}
				// })
			},
			goPage(page) {
				if (!page) {
					return false;
				}
				this.$Router.push({
					name: page
				})
			},

		}
	}
</script>

<style scoped>
</style>
